package com.atwulidun.adapter05.objectdapter;

// 适配器类，聚合src，实现dst
public class VoltageAdapter implements IVoltage5V {
    // 聚合src
    private Voltage220V voltage220V;

    public VoltageAdapter(Voltage220V voltage220V) {
        this.voltage220V = voltage220V;
    }

    // 将220V转换成5V输出
    public int output5V() {
        int src = 0;
        if (voltage220V != null) {
            src = voltage220V.output220V();
        }
        return src / 44;
    }
}
